Fix multiple bugs

- Fix duplication
- Fix event undefined in firefox
Yep, i corrected a mistake