fixes to db generation.
more stuff