A more efficient workaround for erode
Merge pull request #2811 from arkunze:pullreq/140516-erode