backport pull requests #96 and #97 to 1.9 branch