Fix of bug in calculations. New test cases.