Implement #268 on branch 2.x