fixed bug in the send function