make url checking more robust