Fix for issue #532.
Merge pull request #533 from mbrotz/bugfixes

Fix for issue #532.