Fix crash when '|' is the last symbol in the string