fixes #6 null pointer error when writing to XML