Goswin's patches from Debian

I've reconstructed Goswin von Brederlow's patches on

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663520#20

Unfortunately there were some hunks missing (in particular defining "zero") so I improvised. Hopefully I've not broken it too badly. What do you think?

Fixes #1