warning: 'midQ' may be used uninitialized in this function