fix for #2076
pass tests
Merge branch 'rossdeane/master'
Improvements for #2134 (which fixes Issue #2076)