added port_write method