calculation bug fixed