fixing bugs in read xml