Fixed race condition when saving