fixed memory leaks
added exports to js interface