Cherry-picks from 0.9.0-SNAPSHOT to build with Spark 0.8.1