Optimize codes
Some fix

Signed-off-by: Silencieux Le <silencieux.le@gmail.com>