convention fixes and memory leak fixes