fix state save in js file