fix local storage, but, introduce race condition