Fix a bug in filter_next_loci.