Fixed one bug in swapping