Fixed comparison bugs in sync