path_join() made more intelligent