Improve enum and fix some issues