Various changes

Every commit contains self-containing description of what it changes.
This should fix some of the issues that other users have reported.