Fix for issue #109.  Same change as pull request #13 but done slightly differently.