streamlined and fixed sync bug