A few fixes

One is a particularly bad bug, reported lots of times in the forum.