Fix incorrect class exists check