Fix runtime type check