fixed data grabbing in data function