Fixed bug in calculation of mean and std of image