Checking length of arrays and id of temp item