changed is_a to instanceof for better interface support