fixes and memory leaks in world persistence