fix mapbox/tilemill#1807 and update code with other tilemill fixes