Add GetText()

Also fix buffer overrun.