clean library code

Signed-off-by: Felix Yan <felixonmars@gmail.com>