TRQ-2010. Backport pull request 154 (from Matt Ezell) to 4.1-dev.