finish sync code