fix bug in dispatch.py