fix bug after merge weiwei's code