fixed scoping issue with the data access