Fix exception at end of file
Fix exception preventing save - log error rather than throwing it