Change ErrBadRequest to ErrInternal
Set HTTP response code to 500 for internal server errors