Fix recovering id after an insert