Fixed bug with dispatching