fixed a story of updatig refs in js