fix bug in gather.py