Fixing replacement patterns