handle trailing slashes on the path