MDM modified, so it works with python 3 too