further tweaks to exception handling --- more robust