(#1384) Fix db.sync cancel function