I think the problem is that the replacement has incorrect order of operations. Originally, it was adding the half-pixel fixup then multiplying to invert the Y, while the MAD replacement does the Y invert first then the half-pixel fix.
Also Mirek, can you please stop sending your messages as HTML? My client makes your messages nearly unreadable. Thanks.