Fixed several bugs in comm.