porting http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697127