Bugfix in update method.