added patch-7 from Andreas Rueckert