fix handling of internal id