commented out fseek and fflush in write