fixed trailing slash detection