cleaning up some memory issues