fixed a bug with the verbose flag, converted fwrite_chunk to c89.