memory leaks fixed
intermediate code API