fixing a bug in the send code