Only set _id if nonempty