Fix document and node sorting when no metadata exist
Fix typo
Fix permissions retrieval