Ignore separator at end of string. Fixes #3823