Fix sort order for entries. Fix handling when no category specified.