fixed defintiion of send function