Removing nasty memory leak