swap was wrong fixes #247