Fix to Error catching