improvements: id should be updated immediately
when model first saved.
(cherry picked from commit 95af626)