Changed dir_exists function