various improvements to enum

fix a uninitialized memory bug and add a "next" function similar to enums