Fix dataset generation bug