Correct Infinite Loop in publish script.