Fixing error in update method.