Fix bug in parallel dataset construction