Fixed a bug in calculating standard deviation.