Fixed swap bug