add doDispatch
modify the interface of casting and add id_any
apply change
fix
add functions