Bug 266: fixed bug with null ref and modified enumerable set

See #266