Fixed bug in updating