Fixed grammar extraction bug