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