changed isinstance to is subclass