move callback outside of try catch block

Fixes issue #34
If there is an exception within the callback the try-catch block will catch the exception and call the callback a second time, this time with an unrelated error. Moving the callback outside of the try-catch block solves this issue.