fix parser: check end of string.