fix for https://spark-project.atlassian.net/browse/SPARK-1052