more efficient implementation of AdvanceToEOF