add sync token, improve error recovery