Fix index out of bounds when reporting class not found
Do proper xml 1.1 entity escaping