Added check for unwritable tmp folders