Err, I should have tested it before sending the patch, sorry. Here is an updated version of the second patch :