closed #5110, refactor