fix directory not displayed error

This should fix #1041 by cherry-picking 7a6e8ca0d5de14eca99188bc28666d003c467de5 from 961-folder_creation. I tested it on my local machine with spaceportal: It seems to work: 11 folders/files are displayed instead of only 4.