DBAL-446

Fix for DBAL-446 with a proper test case and two general test cases.