fix the permissions of directories and files and some maintenance stuff