Fixes for issue #766