fix the bug which the offset beyond buffer length, the offset should be 0 every time, and use the increase posision to travel the file instead of using offset in buffer