Support spark submit and small fixes