fix name bug in sync function
handle the case where your session expires