Pull request for issue/529

Fixes #529