Fix bug in processing layout rules