resolved nullPointerException while swapping cards.