Fix sync method, will add unittests