add exception handling for callbacks