fix for SPARK-902

https://spark-project.atlassian.net/browse/SPARK-902