Add more validation for secondary indexes

Also ensure empty sets are removed
0.0.20