fix some leaks in parser, add debug code to node manager to find more