fixed a bug with capitalizing the word before ref