replaced many `dynamic_cast` to `static_cast`