fix some incorrect usages of lseek