updated subsample.py