fixed entity to xml functionality