changed undefined $value to $word in foreach loop

Seems that the use of $value was wrong, changing it to $word was a huge success.