BS-11471: fix and add unit test