diff --git a/cport.c b/cport.c
index d339c9a..70f2a91 100644
--- a/cport.c
+++ b/cport.c
@@ -75,19 +75,29 @@ static void exec_subdev_handler(unsigned int id, __u8 *rbuf, size_t size)
 
 void cport_handler(__u8 *rbuf, size_t size)
 {
-	/* FIXME pass cport_msg directly? */
-	struct cport_msg *cmsg = (struct cport_msg *)rbuf;
+	struct op_header *hdr = (void *)rbuf;
 	unsigned int id;
 
-	id = cmsg->cport;
+	if (size < sizeof(*hdr)) {
+		gbsim_error("short message received\n");
+		return;
+	}
+
+	/*
+	 * Retreive and clear the cport id stored in the header pad bytes.
+	 */
+	id = hdr->pad[1] << 8 | hdr->pad[0];
+	hdr->pad[0] = 0;
+	hdr->pad[1] = 0;
 
 	/* FIXME: can identify module from our cport connection */
 	gbsim_debug("AP -> Module %d CPort %d %s request\n  ",
 		    cport_to_module_id(id),
 		    id,
 		    get_protocol(id));
+
 	if (verbose)
-		gbsim_dump(cmsg->data, size - 1);
+		gbsim_dump(rbuf, size);
 
 	exec_subdev_handler(id, rbuf, size);
 
diff --git a/gbsim.h b/gbsim.h
index 48ee400..f4dcc84 100644
--- a/gbsim.h
+++ b/gbsim.h
@@ -53,11 +53,6 @@ extern struct gbsim_info info;
 #define PROTOCOL_STATUS_RETRY	0x04
 #define PROTOCOL_STATUS_BAD	0xff
 
-struct cport_msg {
-	__u8	cport;
-	__u8	data[0];
-};
-
 struct op_header {
 	__le16	size;
 	__le16	id;
diff --git a/gpio.c b/gpio.c
index a071018..d9005e0 100644
--- a/gpio.c
+++ b/gpio.c
@@ -45,20 +45,20 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 	struct op_header *oph;
 	char *tbuf;
 	struct op_msg *op_req, *op_rsp;
-	struct cport_msg *cport_req, *cport_rsp;
 
 	tbuf = malloc(4 * 1024);
 	if (!tbuf) {
 		gbsim_error("failed to allocate gpio handler tx buf\n");
 		return;
 	}
-	cport_req = (struct cport_msg *)rbuf;
-	op_req = (struct op_msg *)cport_req->data;
-	cport_rsp = (struct cport_msg *)tbuf;
-	cport_rsp->cport = cport;
-	op_rsp = (struct op_msg *)cport_rsp->data;
+	op_req = (struct op_msg *)rbuf;
+	op_rsp = (struct op_msg *)tbuf;
 	oph = (struct op_header *)&op_req->header;
-	
+
+	/* Store the cport id in the header pad bytes */
+	op_rsp->header.pad[0] = cport & 0xff;
+	op_rsp->header.pad[1] = (cport >> 8) & 0xff;
+
 	switch (oph->type) {
 	case GB_GPIO_TYPE_PROTOCOL_VERSION:
 		op_rsp->header.size = sizeof(struct op_header) +
@@ -72,7 +72,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_LINE_COUNT:
 		op_rsp->header.size = sizeof(struct op_header) +
@@ -85,7 +85,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_ACTIVATE:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -96,7 +96,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->gpio_act_req.which);
 		if (verbose)
 			gbsim_dump((__u8 *)op_req, op_req->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_DEACTIVATE:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -107,7 +107,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->gpio_deact_req.which);
 		if (verbose)
 			gbsim_dump((__u8 *)op_req, op_req->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_GET_DIRECTION:
 		op_rsp->header.size = sizeof(struct op_header) +
@@ -123,7 +123,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->gpio_get_dir_req.which, op_rsp->gpio_get_dir_rsp.direction);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_DIRECTION_IN:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -138,7 +138,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			libsoc_gpio_set_direction(gpios[op_req->gpio_dir_output_req.which], INPUT);
 		else
 			gpio_dir[op_req->gpio_dir_output_req.which] = 0;
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_DIRECTION_OUT:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -153,7 +153,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			libsoc_gpio_set_direction(gpios[op_req->gpio_dir_output_req.which], OUTPUT);
 		else
 			gpio_dir[op_req->gpio_dir_output_req.which] = 1;
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_GET_VALUE:
 		op_rsp->header.size = sizeof(struct op_header) +
@@ -169,7 +169,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->gpio_get_val_req.which, op_rsp->gpio_get_val_rsp.value);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, op_rsp->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_SET_VALUE:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -182,7 +182,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			gbsim_dump((__u8 *)op_req, op_req->header.size);
 		if (bbb_backend)
 			libsoc_gpio_set_level(gpios[op_req->gpio_set_val_req.which], op_req->gpio_set_val_req.value);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_SET_DEBOUNCE:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -193,7 +193,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->gpio_set_db_req.which, op_req->gpio_set_db_req.usec);
 		if (verbose)
 			gbsim_dump((__u8 *)op_req, op_req->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_IRQ_TYPE:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -205,7 +205,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    op_req->gpio_irq_type_req.type);
 		if (verbose)
 			gbsim_dump((__u8 *)op_req, op_req->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_IRQ_ACK:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -216,7 +216,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport, cport_to_module_id(cport));
 		if (verbose)
 			gbsim_dump((__u8 *)op_req, op_req->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_IRQ_MASK:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -227,7 +227,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport, cport_to_module_id(cport));
 		if (verbose)
 			gbsim_dump((__u8 *)op_req, op_req->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 		break;
 	case GB_GPIO_TYPE_IRQ_UNMASK:
 		op_rsp->header.size = sizeof(struct op_header) + 0;
@@ -238,7 +238,7 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport, cport_to_module_id(cport));
 		if (verbose)
 			gbsim_dump((__u8 *)op_req, op_req->header.size);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, op_rsp->header.size);
 #define TEST_HACK
 #ifdef TEST_HACK
 		op_req->header.size = sizeof(struct op_header) + 1;
@@ -246,10 +246,9 @@ void gpio_handler(unsigned int cport, __u8 *rbuf, size_t size)
 		op_req->header.type = GB_GPIO_TYPE_IRQ_EVENT;
 		op_req->header.result = 0;
 		op_req->gpio_irq_event_req.which = 1;
-		cport_req->cport = cport;
 		gbsim_debug("Module %d -> AP CPort %d GPIO protocol IRQ event request\n  ",
 			    cport_to_module_id(cport), cport);
-		write(cport_in, cport_req, op_req->header.size + 1);
+		write(cport_in, op_req, op_req->header.size);
 #endif
 		break;
 	case OP_RESPONSE | GB_GPIO_TYPE_IRQ_EVENT:
diff --git a/i2c.c b/i2c.c
index 4cc840e..69f35ce 100644
--- a/i2c.c
+++ b/i2c.c
@@ -34,7 +34,6 @@ void i2c_handler(unsigned int cport, __u8 *rbuf, size_t size)
 	struct op_header *oph;
 	char *tbuf;
 	struct op_msg *op_req, *op_rsp;
-	struct cport_msg *cport_req, *cport_rsp;
 	int i, op_count;
 	__u8 *write_data;
 	bool read_op;
@@ -47,12 +46,13 @@ void i2c_handler(unsigned int cport, __u8 *rbuf, size_t size)
 		gbsim_error("failed to allocate i2c handler tx buf\n");
 		return;
 	}
-	cport_req = (struct cport_msg *)rbuf;
-	op_req = (struct op_msg *)cport_req->data;
-	cport_rsp = (struct cport_msg *)tbuf;
-	cport_rsp->cport = cport;
-	op_rsp = (struct op_msg *)cport_rsp->data;
+	op_req = (struct op_msg *)rbuf;
+	op_rsp = (struct op_msg *)tbuf;
 	oph = (struct op_header *)&op_req->header;
+
+	/* Store the cport id in the header pad bytes */
+	op_rsp->header.pad[0] = cport & 0xff;
+	op_rsp->header.pad[1] = (cport >> 8) & 0xff;
 	
 	switch (oph->type) {
 	case OP_I2C_PROTOCOL_VERSION:
@@ -68,7 +68,7 @@ void i2c_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case OP_I2C_PROTOCOL_FUNCTIONALITY:
 		sz = sizeof(struct op_header) +
@@ -82,7 +82,7 @@ void i2c_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case OP_I2C_PROTOCOL_TIMEOUT:
 		sz = sizeof(struct op_header) + 0;
@@ -94,7 +94,7 @@ void i2c_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case OP_I2C_PROTOCOL_RETRIES:
 		sz = sizeof(struct op_header) + 0;
@@ -106,7 +106,7 @@ void i2c_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case OP_I2C_PROTOCOL_TRANSFER:
 		op_count = le16toh(op_req->i2c_xfer_req.op_count);
@@ -174,7 +174,7 @@ void i2c_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 
 		break;
 	default:
diff --git a/i2s.c b/i2s.c
index 9616b22..aa18fa0 100644
--- a/i2s.c
+++ b/i2s.c
@@ -26,7 +26,6 @@ void i2s_mgmt_handler(unsigned int cport, __u8 *rbuf, size_t size)
 	struct op_header *oph;
 	char *tbuf;
 	struct op_msg *op_req, *op_rsp;
-	struct cport_msg *cport_req, *cport_rsp;
 	struct gb_i2s_mgmt_configuration *conf;
 	size_t sz;
 
@@ -35,13 +34,14 @@ void i2s_mgmt_handler(unsigned int cport, __u8 *rbuf, size_t size)
 		gbsim_error("failed to allocate i2s handler tx buf\n");
 		return;
 	}
-	cport_req = (struct cport_msg *)rbuf;
-	op_req = (struct op_msg *)cport_req->data;
-	cport_rsp = (struct cport_msg *)tbuf;
-	cport_rsp->cport = cport;
-	op_rsp = (struct op_msg *)cport_rsp->data;
+	op_req = (struct op_msg *)rbuf;
+	op_rsp = (struct op_msg *)tbuf;
 	oph = (struct op_header *)&op_req->header;
 
+	/* Store the cport id in the header pad bytes */
+	op_rsp->header.pad[0] = cport & 0xff;
+	op_rsp->header.pad[1] = (cport >> 8) & 0xff;
+
 	switch (oph->type) {
 	case GB_I2S_MGMT_TYPE_GET_SUPPORTED_CONFIGURATIONS:
 		sz = sizeof(struct op_header) +
@@ -73,13 +73,11 @@ void i2s_mgmt_handler(unsigned int cport, __u8 *rbuf, size_t size)
 		conf->ll_wclk_rx_edge = GB_I2S_MGMT_EDGE_RISING;
 		conf->ll_data_offset = 1;
 
-
-
 		gbsim_debug("Module %d -> AP CPort %d I2S GET_CONFIGURATION response\n  ",
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_I2S_MGMT_TYPE_SET_CONFIGURATION:
 		sz = sizeof(struct op_header);
@@ -93,7 +91,7 @@ void i2s_mgmt_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_I2S_MGMT_TYPE_SET_SAMPLES_PER_MESSAGE:
 		sz = sizeof(struct op_header);
@@ -107,7 +105,7 @@ void i2s_mgmt_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_I2S_MGMT_TYPE_SET_START_DELAY:
 		sz = sizeof(struct op_header);
@@ -121,7 +119,7 @@ void i2s_mgmt_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_I2S_MGMT_TYPE_ACTIVATE_CPORT:
 		sz = sizeof(struct op_header);
@@ -135,7 +133,7 @@ void i2s_mgmt_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_I2S_MGMT_TYPE_DEACTIVATE_CPORT:
 		sz = sizeof(struct op_header);
@@ -149,7 +147,7 @@ void i2s_mgmt_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	default:
 		gbsim_error("i2s mgmt operation type %02x not supported\n", oph->type);
@@ -164,7 +162,6 @@ void i2s_data_handler(unsigned int cport, __u8 *rbuf, size_t size)
 	struct op_header *oph;
 	char *tbuf;
 	struct op_msg *op_req, *op_rsp;
-	struct cport_msg *cport_req, *cport_rsp;
 	size_t sz;
 
 	tbuf = malloc(4 * 1024);
@@ -172,13 +169,14 @@ void i2s_data_handler(unsigned int cport, __u8 *rbuf, size_t size)
 		gbsim_error("failed to allocate i2s handler tx buf\n");
 		return;
 	}
-	cport_req = (struct cport_msg *)rbuf;
-	op_req = (struct op_msg *)cport_req->data;
-	cport_rsp = (struct cport_msg *)tbuf;
-	cport_rsp->cport = cport;
-	op_rsp = (struct op_msg *)cport_rsp->data;
+	op_req = (struct op_msg *)rbuf;
+	op_rsp = (struct op_msg *)tbuf;
 	oph = (struct op_header *)&op_req->header;
 
+	/* Store the cport id in the header pad bytes */
+	op_rsp->header.pad[0] = cport & 0xff;
+	op_rsp->header.pad[1] = (cport >> 8) & 0xff;
+
 	switch (oph->type) {
 	case GB_I2S_DATA_TYPE_SEND_DATA:
 		sz = sizeof(struct op_header);
@@ -192,7 +190,7 @@ void i2s_data_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	default:
 		gbsim_error("i2s data operation type %02x not supported\n", oph->type);
diff --git a/pwm.c b/pwm.c
index ed16cab..daac695 100644
--- a/pwm.c
+++ b/pwm.c
@@ -37,7 +37,6 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 	struct op_header *oph;
 	char *tbuf;
 	struct op_msg *op_req, *op_rsp;
-	struct cport_msg *cport_req, *cport_rsp;
 	size_t sz;
 	__u32 duty;
 	__u32 period;
@@ -47,13 +46,15 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 		gbsim_error("failed to allocate i2c handler tx buf\n");
 		return;
 	}
-	cport_req = (struct cport_msg *)rbuf;
-	op_req = (struct op_msg *)cport_req->data;
-	cport_rsp = (struct cport_msg *)tbuf;
-	cport_rsp->cport = cport;
-	op_rsp = (struct op_msg *)cport_rsp->data;
+
+	op_req = (struct op_msg *)rbuf;
+	op_rsp = (struct op_msg *)tbuf;
 	oph = (struct op_header *)&op_req->header;
-	
+
+	/* Store the cport id in the header pad bytes */
+	op_rsp->header.pad[0] = cport & 0xff;
+	op_rsp->header.pad[1] = (cport >> 8) & 0xff;
+
 	switch (oph->type) {
 	case GB_PWM_TYPE_PROTOCOL_VERSION:
 		sz = sizeof(struct op_header) +
@@ -68,7 +69,7 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_PWM_TYPE_PWM_COUNT:
 		sz = sizeof(struct op_header) + sizeof(struct pwm_count_rsp);
@@ -81,7 +82,7 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_PWM_TYPE_ACTIVATE:
 		sz = sizeof(struct op_header) + 0;
@@ -93,7 +94,7 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->pwm_act_req.which);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_PWM_TYPE_DEACTIVATE:
 		sz = sizeof(struct op_header) + 0;
@@ -105,7 +106,7 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->pwm_deact_req.which);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_PWM_TYPE_CONFIG:
 		sz = sizeof(struct op_header) + 0;
@@ -123,7 +124,7 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->pwm_cfg_req.which, duty, period);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, op_rsp->header.size + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_PWM_TYPE_POLARITY:
 		sz = sizeof(struct op_header) + 0;
@@ -144,7 +145,7 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    op_req->pwm_pol_req.polarity ? "inverse" : "normal");
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_PWM_TYPE_ENABLE:
 		sz = sizeof(struct op_header) + 0;
@@ -159,7 +160,7 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->pwm_enb_req.which);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	case GB_PWM_TYPE_DISABLE:
 		sz = sizeof(struct op_header) + 0;
@@ -174,7 +175,7 @@ void pwm_handler(unsigned int cport, __u8 *rbuf, size_t size)
 			    cport_to_module_id(cport), cport, op_req->pwm_dis_req.which);
 		if (verbose)
 			gbsim_dump((__u8 *)op_rsp, sz);
-		write(cport_in, cport_rsp, sz + 1);
+		write(cport_in, op_rsp, sz);
 		break;
 	default:
 		gbsim_error("pwm operation type %02x not supported\n", oph->type);
