fixing memory over-releases