Fix Stats printing and Magic square costOnVariable function.