Minor fix of exception logic