added mean and sd functions
fixed some bugs in mean and sd functions
Merge remote-tracking branch 'upstream/master'