fix Javascript bug