fixed bug in Swap elements