Fixed the problems with merging rules.