fix some xml errors, add some tests.