rewrite instanceof