Fix deadlock issue with custom Enum implementation