outIndex will always change if out is null