fix sorting in OTA restore