fixed infinite loop, changed path variables