Fix for issue #340.

Fixes #340.