fixed JS bug