added some xml state checks for convinience