Fixed error in javascript