Fixes per a pull request from matthewbentley.