Fix Nodeindex bug

Test case and fix for #4