Fixed database class

+ Fixed databse class
+ Fixed other cms class to work with database