bug fix from Peter Kankowski