- fixed some memory management issues