Fixed some DBMS bugs