Fix exception handling dict keys