Fix ar mask generation.