fixed XML parsing
added optional checking of record before storing