minors changes to update function