updated how on('data', is handled