Nack messages before invoking error handlers

Fixes #111.
Sync with upstream