Fix multiple bugs [Do not merge]

- Fix duplication
- Fix event undefined in firefox
Can you remove your debug logging?