various bugfixing (to be completed) for the db update scripts