fixed incoming data function