Further bugfixes for multi-DB setup