more replace printf to fprintf