ensure isintance correctly handles subclasses