Fix two issues related to Spark