Fixed bug with mean image