fixed bug when log file not written