Fixing lseek() in gen chunks