fix coding style and dead code