fix crash if directory not exist