Various and sundry fixes

Fixes for bugs uncovered by @bbangert's [tester](https://github.com/bbangert/push-tester) and my [Go port](https://github.com/kitcambridge/push-tester-go), along with a Heka logging refactor.