fixed bug in M2_HOME handling