fix a problem which will cause memory leak