BUG: generate_data caused rare Error when run on cluster