qr_max variable set right