Add tests for NodeLocator and fix bugs