install fixes

fix mainly for initialization of db tables on a new install.
Credit to Fabrice Anon for this fix.