Fixed some bugs again.

The calculation of small matrices (and maybe edge matrices) were not
correct in some cases. The small matrix calculations are still not
correct if the curve is two-sided and the twist is larger than the first
interval.

In fact the small matrix might not even be needed and it might be
removed later.