improve robustness
BS-9610: clean code