fix the permissions of directories and files