Fixes and improvements from Debian

Here are fixes and improvements that we accumulated in Debian.