Corrected a bug in iMad.py