Fix a bug in collect.sh