[BUGFIX] Take into account all file and folder permissions