Fix overwrite of mask file.