refactoring, small APCFG grammar fixes