bug fix suggested by WAH Spekkink