modified exception handling