Fix bug in text splitting