safe sync and localstorage