Fix multiple bugs [Do not merge]

- Fix duplication
- Fix event undefined in firefox