Fix places where a negative return from ftello could be used as invalid input