fixed the error handler to send a 500 http error.