guarding against SEH in some edge cases