Fixed some bugs.

Signed-off-by: neosfung@t400 <neosfung@gmail.com>