Fixed writing to error_log