write only on success