Fixes a bug on the document list sort