fix swapped variables