Bug fixes.

Signed-off-by: Min Chen <minchnew@gmail.com>