fix code style and some bug