main globals corrected