Improvement for enum class checking