fix resize memory leak