Fix null pointer.
Add write method to append single entry.