debugging subsample routine