Fix unit bug. close #669