Fixing bugs where failed sends crashes the gateway.

This has led to some of the recent instability we've seen (@joshholmes and me)