Fixed calculation of differences of columns