Fix issue #1.

Does what it says. All based on the work of Elisabeth Newton in pull request #2 in pwpy.