fixed JS code