added directory existing detect