closed #4861, refactor