make some code more robust in case of permissions issues
make some code more robust in case of permissions issues

DrXyzzy/smc,sagemathinc/smc,tscholl2/smc,DrXyzzy/smc,sagemathinc/smc,tscholl2/smc,sagemathinc/smc,tscholl2/smc,DrXyzzy/smc,DrXyzzy/smc,tscholl2/smc,tscholl2/smc,sagemathinc/smc