Fix bug with subsampling