Updated check for localstorage