fixed write to file of errors and time