Fix for bug fb35eb59dd, thanks to Paul Walton for the report and Marc Culler for the patch