Fixed error in update code