Added more error handling to checkxml