Use clear_error() instead of clearing the error manually