Inifnite loop bug fixed, caused by referencing the wrong path