Fix `asInstanceOf` pattern matching.
Fix doctors tracing.