fixed assert_instance_of to support polymorphic models