fixed bug if shared folder contains not shared sub folders

- fixed bug if shared folder contains not shared sub folders
- fixed database query 2 -> 1