Fix calculation of second moment.