Fix serious oversight in entry sorting code. Oops.