db fixes to make v4.0.0 run on MAMP

I found that the latest version wouldn't run locally on MAMP without this changes.