Fix some bugs in flashcard creation