More fixes to database builder