fixing sync hanging in pulpv2

based off this commit 4c8a60b81564474cc2c36c245a9e2897525811f6
but with a slightly different algorithm