Added trailing slash removal to fix path problems.