Fixing bugs where failed sends crashes the gateway.