removing unneeded trailing whitespace in url