added some file/dir exists validation