Fixes for issue #777