Fixed checking of class exists