more bugfixes for bug #296

The first fix was incomplete.