several small fixes, many taken from Debian testing