Ensure callback is not called multiple times on error

Fix #85