Fixed a bug where the program would end prematurely.