fix spark-1777 bugs