some fixes in send function