amend dispatch function