finally fixed JS