added exception handling support