fix bug in distribute.py