fix trailing slash problem