Cosmetics gcc 4.6.3

Added assert to fwrite calls