Fixed a potential bug detecting class existence