bug fix: buggy operations due to the swap action