Fixes JS warnings

- Not used variables
- Usage of possible not initialized variables