fix trailing slash bug