ESP loader fails for certain subrecord orders

OpenMW 0.47 b2791fd4

Here are two mods, they are identical but the order of subrecords.

RefOrderTest.A.ESP
RefOrderTest.B.ESP

Load the first (A) and go to the following coordinates:
x:-23350, y: -16450, z: 510, z-angle: 145
You will see the placed crate.

If you load the second one (B), the crate disappears.

Here the mod content as seen by tes3cmd:

$ tes3cmd dump RefOrderTest.A.ESP 

Record: TES3 "()" Flags:0x0000 ()
  HEDR:   Version:1.3  Is_Master:False  Author:""
  Description:""
  N_Records:1
 *MAST: Master:Morrowind.esm
  DATA: Length:79837557

Record: CELL "balmora (-3, -2)" Flags:0x0000 ()
  NAME: Name:Balmora
  DATA: (Exterior) Coordinates: (-3, -2)  Flags:0x0006 (Has_Water, Illegal_To_Sleep_Here)
  RGNN: Region:West Gash Region
  NAM0: Reference_Count:2
  MVRF: ObjIdx:41387  MastIdx:1
  CNDT: X:-3  Y:-3 (External Cell Destination)
 *FRMR: ObjIdx:41387  MastIdx:1
  NAME: Name:crate_02_food
  DATA: X:-23198.844  Y:-16591.123  Z:536.000  X_Angle:0.0000  Y_Angle:0.0000  Z_Angle:0.3997
 *FRMR: ObjIdx:41385  MastIdx:1
  NAME: Name:crate_02_food
  DELE: Deleted:4729956
$ tes3cmd dump RefOrderTest.B.ESP 

Record: TES3 "()" Flags:0x0000 ()
  HEDR:   Version:1.3  Is_Master:False  Author:""
  Description:""
  N_Records:1
 *MAST: Master:Morrowind.esm
  DATA: Length:79837557

Record: CELL "balmora (-3, -2)" Flags:0x0000 ()
  NAME: Name:Balmora
  DATA: (Exterior) Coordinates: (-3, -2)  Flags:0x0006 (Has_Water, Illegal_To_Sleep_Here)
  RGNN: Region:West Gash Region
  NAM0: Reference_Count:2
 *FRMR: ObjIdx:41385  MastIdx:1
  NAME: Name:crate_02_food
  DELE: Deleted:4729956
  MVRF: ObjIdx:41387  MastIdx:1
  CNDT: X:-3  Y:-3 (External Cell Destination)
 *FRMR: ObjIdx:41387  MastIdx:1
  NAME: Name:crate_02_food
  DATA: X:-23198.844  Y:-16591.123  Z:536.000  X_Angle:0.0000  Y_Angle:0.0000  Z_Angle:0.3997

The order of those subrecords should not be relevant, besides the broken order is seldom seen by openmw-cs saving operation.

Edited by Evil Eye