changed status code back to 500 for internal errors