Fix multiple bugs

- Fix duplication
- Fix event undefined in firefox
ok it actually fixes the indentation, nvm