A set of portability fixes from the Debian packaging