Fixed the getNextCard function.