Fixing assigning of id.