Fix allowEmpty and null issues with enums.

Pointed out by @ferjgar in issue #84 (comment).