Bugfixes and added xml support