fixed index out of bounds error that occurs when message only consists of whitespace