Fixes some minor bugs
Signed-off-by: Rack Lin <racklin@gmail.com>