Fix bug with random word picking on loss