bugfix in send data function