replaced get_class with instanceof