MATH IS HARD! fix seeking behavior near end of file