Fix last entity IDs.