correct variable calculation