Fixed bug with sync