修改bug；整理代码

Signed-off-by: servanter <fengshang@126.com>