changed isCompatible function in type classes