changed xmlreader so write segfaults less often