Fixed some issues with SparkContext