minimal changes w.r.t to upstream