Fixed bug where crashes in callback would result in callback being called twice