closed #4577: little refactor