Fix #83. Fix parsing of qnames and add test.

Can please somebody else check as well if this doesn't break anything.