Fix #437
Add tests.
Merge pull request #438 from Thinkscape/patch-1

Fix #437