From: Paolo valente <redacted>
Date: Tue, 26 Feb 2013 18:02:46 +0100
The portions of the code interested by each fix are small and do not
overlap with each other, so I decided to provide just one patch
(I hope that this was the right choice).
Please split this up into 6 patches, each with an appropriately
verbose analysis and explanation of each bug being fixed, thanks.