Adding a check for trailing slash should work.