Correcting typo and error in mean function