Cperello/s4sync fixes

Rubén is adding tests to catch the bugs fixed here on his wintest branch so we catch them if we get any regression.