heh
fixing more bugs and memory leaks