Fix bugs with attribute read before model save