fix sorting bugs; enable sorting links