improve #322 so we trim trailing / just in case to avoid // in a path