Core/DBLayer: Added missing fixes from 395ac461a86f23bbb66d555f528914b28d63042e