Fix a bug in the trailing-slash handling.