Fixes for issue 845