Further fixes to bdb