fix id logic