adding debug information for 500 errors