changes on checkDir to work propper