fix bug in sync