fixed fwrite in p_tick.c