Handle disabled location settings

Add code to handle the scenario that the location is disabled.