added more class checks