db install script and some bugfixes