Fixed getNextCard function