correct variable caculation