Debugging errors in getNode and rest of program