Fixed Bug in JS