Fixed bug in update code.