Added asEnum support
fixes #1