Replace miscllaneous forms of type checks with isinstance calls