Throwing an exception when an invalid object is written.
Updated changelog, fixed test.