modify logic by wanggao