Fix for issue 2490.

Applied against 0.8.0 tag.