Fix deleting bug with sync