Fixing difference calculation bug.