Fix for Mantis 1172 from Andrew Plotkin
Merge branch 'davidk'