apply patch from http://dbmail.org/mantis/view.php?id=926