replace is_a() with instanceof