fixed bugs in newCard function