added checks for xml elements