Fixed bug in CDatabase