ESDEV-463 - created test for bug #5409, implemented the fix, updated one old test