Fix exception throwing