safe update algorithm bugfix