title: neo4j spatial-creating layer giving exception
body: <p>using below versions for my app, but getting exception while creating spatial layer</p>
  
  <p>neo4j = neo4j-enterprise-2.1.7</p>
  
  <p>spatial = neo4j-spatial-0.13-neo4j-2.1.2-server-plugin</p>
  
  <p>while adding layer with REST API, getting below exception:
  Creating new layer 'geoindex_venues' unless it already exists
  13:34:49.466 [qtp22441773-51] WARN  o.e.jetty.servlet.ServletHandler - /db/data/index/node/
  java.util.NoSuchElementException: More than one element in org.neo4j.cypher.internal.compiler.v2_1.PipeExecutionResult$$anon$1@46935c97. First element is 'Node[0]' and the second element is 'Node[1]'
          at org.neo4j.helpers.collection.IteratorUtil.single(IteratorUtil.java:338) ~[neo4j-kernel-2.1.7.jar:2.1.7]
          at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:128) ~[neo4j-kernel-2.1.7.jar:2.1.7]
          at org.neo4j.helpers.collection.IteratorUtil.single(IteratorUtil.java:143) ~[neo4j-kernel-2.1.7.jar:2.1.7]
          at org.neo4j.gis.spatial.utilities.ReferenceNodes.getReferenceNode(ReferenceNodes.java:45) ~[neo4j-spatial-0.13-neo4j-2.1.2.jar:na]
          at org.neo4j.gis.spatial.SpatialDatabaseService.getSpatialRoot(SpatialDatabaseService.java:76) ~[neo4j-spatial-0.13-neo4j-2.1.2.jar:na]
          at org.neo4j.gis.spatial.SpatialDatabaseService.getLayer(SpatialDatabaseService.java:108) ~[neo4j-spatial-0.13-neo4j-2.1.2.jar:na]
          at org.neo4j.gis.spatial.SpatialDatabaseService.getOrCreatePointLayer(SpatialDatabaseService.java:187) ~[neo4j-spatial-0.13-neo4j-2.1.2.jar:na]
          at org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.(LayerNodeIndex.java:90) ~[neo4j-spatial-0.13-neo4j-2.1.2.jar:na]
          at org.neo4j.gis.spatial.indexprovider.SpatialIndexImplementation.nodeIndex(SpatialIndexImplementation.java:47) ~[neo4j-spatial-0.13-neo4j-2.1.2.jar:na]
          at org.neo4j.kernel.impl.coreapi.IndexManagerImpl.getOrCreateNodeIndex(IndexManagerImpl.java:318) ~[neo4j-kernel-2.1.7.jar:2.1.7]
          at org.neo4j.kernel.impl.coreapi.IndexManagerImpl.forNodes(IndexManagerImpl.java:302) ~[neo4j-kernel-2.1.7.jar:2.1.7]
          at org.neo4j.server.rest.web.DatabaseActions.createNodeIndex(DatabaseActions.java:398) ~[neo4j-server-2.1.7.jar:2.1.7]
          at org.neo4j.server.rest.web.RestfulGraphDatabase.jsonCreateNodeIndex(RestfulGraphDatabase.java:866) ~[neo4j-server-2.1.7.jar:2.1.7]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_75]
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_75]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_75]
          at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_75]
          at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) ~[jersey-server-1.9.jar:1.9]
          at org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139) ~[neo4j-server-2.1.7.jar:2.1.7]
          at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) ~[jersey-server-1.9.jar:1.9]
          at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699) ~[jersey-server-1.9.jar:1.9]
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) ~[javax.servlet-3.0.0.v201112011016.jar:na]
          at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698) ~[jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:505) [jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432) [jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:92) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.Server.handle(Server.java:445) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358) [jetty-io-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601) [jetty-util-9.0.5.v20130815.jar:9.0.5.v20130815]
          at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532) [jetty-util-9.0.5.v20130815.jar:9.0.5.v20130815]
          at java.lang.Thread.run(Thread.java:745) [na:1.7.0_75]</p>