possible buffer overflow bug fix