Hopefully fixed memory leak