memory management fix
merge