properly handle path prefixes