Fixed errors in xml generation