Fix crash during exception handling