Fixes some bugs with non valid urls