Bugfix in update_mean (NaN will propagate indefinitly)