Fix minor bugs on SparkILoop