fix the order in which the entitiy flags are being read