db init script and fixes to go with it