Fix record ids to correctly sort on a, ofs