fixing bugs around node-type indexing plus some code update for Java 7