small bug in update() corrected