more robust handling of bad urls