4051 troubles

Try reading twice each time, give the internal ADC a chance to settle on the voltage being read:

var0 = analogRead(A2);
var0 = analogRead(A2);

var1 = analogRead(A2);
var1 = analogRead(A2);