nil check and added test case for storeURLWithName