fixing directory deletion issue