Fixed multiple issues including memory consumption on large XML files.