Some bug fixes in netty code