added try and catch exception handling helpers to work around die signal handler