Backport PR 500 to 1.8.x