sort commands when dispatching