fix bug in rules