some changes to exception handling