Added missing localstorage check