Fixed a bug where if it was the last element it would always say 4096
(which was wrong for our test cases anyways) instead of nodes.length-1
which is what it will now print out