Better base path resolution