fixed the double update problem