Fix maxlength patch