change last_insert_id to currval