bug fixes, no memory leaks