wrapped try around localstorage