Added better diagnostics for 500 error codes