Fixed all the tests. Last problem was handling of attribute names, they need to be safe-encoded in many cases, including upper-case characters.