Backend dbms fixes

Escape identifiers properly in the backend. Also fix a bunch of stuff in the catalog.