use current and new value in write_if calculation