Fix ID calculation