fixed bug in optimize_pair_all_datasets.py