fix exit crash due to forced loop stop