only update when necessary