removing some memory problems