Fix bug in [UNDEFINED].
Make WORD work with all end-of-line and end-of-file conditions.