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