Fix totalVal

Use post-increment will make totalVal get totalValueNow before increment. @see http://www.w3schools.com/js/js_operators.asp