Fix for issue #1039.