Fix a problem in the curs_pos calculation