Fix bugs of generate and use temp id for submit item