Is dynamic_pointer_cast really necessary here?