added totalscore variable and fixed a bug in index.html