Add check for undefined localstorage values