Make sure callback is called when an error occurs.