fix bug proposed by xinyuanfan