fixed some bugs with transmit side, still need to do cleanup