Fixes #5965.
Fixes #5452: Errors occurring after the response is sent are not displayed