fix #4177, fix refactoring mistake in a86a2aa