fixing bug in ERR and rewriting MassComparison