fix sync function bug