Keep state changes when other function reverts