fixed issues with data handling