small changes to match_lib.py