Make error handlers send the right response codes