Fixed log_error function