fix url trimming (this should maybe be done somewhere else)