fix bug related to internal node indexing