Fixed error handling so that the callback isn't called again if it throws an exception