fixes some memory bugs