added write to error log