Fix send state machine & add debug statements