Closes #209 (backport).