fixed a bug with large datasets