fix hang in assignLevels