Issue #60 and #61

Fix problem with swapping. Also add test case for that example. And fix typo.