fixed error in javascript