modify bugs in send function