fixed bugs in test.py and mrf.py