bug 1316: rework on calculation