Exception handling fix