Fix ids checking