check that key exists before comparing url