Fix logmask calculation.