fixed index out of bounds issue with some of the nodes