lib/ui.py: bugs fixing

Signed-off-by: Dong Zhu <donzhu@cisco.com>