credit Martin Kluge's with another bug fix