reorg some code of syncwarrior