Fixes to db prep script