MobileCAI: replace some dynamic_cast's