fixed bug in collect.py