fixed a bug on swapping words