finished fixing QC_sample.py bugs