Fixing javascript for stats