Backport of #299 to 1.3

Original PR by @slfritchie: #299 

Made with `git format-patch` on original branch and `git am`. Patches merged cleanly with no changes.