fixed a few bugs, added from_xml