fix out of range cursor