update to make masks handle lists