Fix permissions on files written by root
Now tested with 10.9.1
More error-checking