improved parsePath()