Fix trailing slash problem