issue #5183, refactor