prevented double update in js