fixing a bug when set the Enum value by its index