adding more debug and checks to xml handling
adding some debug to handler