fixed legend code in DImean function