Additional database bug fixes