fixed possible buffer overflow