ensure class isset before comparing