fix bug proposed by fan xinyuan