fixed subsample script