Fix minor bug in fetch data function.