Updated failure catching in cd