fix invalid call of std:.swap()