fixed a crash bug in Rterm