I have just applied and tested these patches, which seem to work for me. The second patch doesn't completely get applied (one hunk is rejected), but the problem is fixed regardless.