Fixed getCardType and fixed fatal bugs