Corrected a critical flaw, which caused an endless loop