fix to update function