Debugging why cursor won't move to the next row