fixed localstorage logic