fix update logic