fixing scope for nodeIndex