fix potential file seeking issue