fix gas spreading code