Fixed bug in sync