Bunch of corrections in case of multi-schema database