fixed a recursive loop which was killing the script due to a typo