fix stack issues with large data sets