Better check on the success of dyn_casts.