fix bug for memory leak while adding common files