simutaneously update two inter-ralted variables