Changed dir_exist function