Fixed a bug with the url fixing

and made it neater