Some minor cleaning up [ci skip].
A lot (too many!) changes to improve our handling of file permissions changes (#257).