Fixes for domain handling when throwing exceptions