nodeSetExpanded: support undefined flag

I committed the buggy code earlier in #91. When `flag` argument in `nodeSetExpanded` is undefined it should be treated as true. This will fix the bug.