Dynamically determine cores properly