Bugfix of rule generator. Now most rules seem to work.