fix code style and remove dead code