fixed swaped variables