Port for new spark version