handling empty urls properly