Fixing a bug in the swap operator