Fix more memory problems