Fixed memory problems and other things in comm.