Applied several s4sync fixes so it's more robust