fixed a bug in std.dev. calculation