backport recent changes to Scala 2.9