Issue #2325459 by DamienMcKenna: Used JSHint to correct some minor JS bugs.