fix standard deviation calculation