Added check for nodes index