check for class isAssignableFrom
mergin with mtoth5 pull request