fix card block and memory leak