fix bug in dataset_store, move build_demand to utilities and document it better