Fix mask read bug