Fix offline sync bug