defer here cause a memory leak