Fixed bug in fwrite