Weird, looks like if you discard when there is only one more spot left, it triggers the ending. But seems to work correctly when there are more spots left.