added an lseek to make sure file starts at begining again