Some tweaks to https://github.com/gradle/gradle/pull/291.