fix bug in dispatcher code.