Add optionally unrolled reader to aid testing, and fix a bug in the mask reader