Fixes suggested by David Engster <deng@randomsample.de>.