add a better check for class types