fixed memory leaks maybe?