checking for array out of bounds on current position