fixes #344

user file traversal protection
proper xml preservation