(Hopefully) fixed memory leak