malformed request when max option is not defined

Example from README.md (basic use, step 4) used to crash the process, whereas running examples.basic.js worked fine.

It turned out that this was because when option "max" is omitted, the XML did not encode any document, as variable length only got defined when max exists.

Attached code fixes this by defining the variable length when max is not set.