Solution for meanmode problem