fix mem leak in previous commit