add fixes from tm2

See https://github.com/mapbox/tm2/pull/394