corrected an error in swap