Modify enum matching

- fix a bug related to object (hash)
- enable to use loose type matching