Turns out there was a reason those things were inside the if

Otherwise you get bounds errors. Luckily I fixed the curs_pos thing
in the last commit