Use current and new value in write_if calculation