add write_if option