Small refactoring in sync
Fix #51