Mask mode -max-len fixes. See #837