Fix for bug fb35eb59dd, thanks to Paul Walton for the report and Marc Culler for the patch
merge 8.5; update changes