Fix bugs in user sync