Javascript bug fixed