Fix while loop taking full CPU when selecting semester