DB/Misc: Cherry Picking missing commits

Some fixes which I pushed to 3.3.5 which are also valid for 6.x.x but have been missed