CA-145685: Polish fix and unit test

Signed-off-by: Flavien Quesnel <flavien.quesnel@citrix.com>