Database abstraction layer fixes