fix trailing slash behaviour