fix file open and remove folders in data