Handle a trailing slash as per pmclanahan's comment