finally a working sync, but not perfect yet