Fixed a bug in sync