Rule engine fix

Should fix a problem found in #124