Fixed handling of error message