Fixed possible buffer overflow