Fixed atomic save problem, added tests for pre and post save events